n = int(input())
k = int(input())
c = [0] * 1001
for _ in range(n):
    c[int(input())] += 1

ans_pairs = ans_sum = 0
rest = -1
for i in range(1000, 0, -1):
    if c[i] == 0:
        continue  
    if rest >= 0:
        if rest - i <= k:
           c[i] += 1
        else:
           ans_sum += rest 
        rest = -1
    ans_pairs += c[i] // 2
    if c[i] % 2 != 0:
        rest = i
if rest >= 0:
    ans_sum += rest 
print(ans_pairs, ans_sum, sep='\n')
